package com.ghh.controller;

import com.ghh.dao.SmsDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sms")
public class SmsController {

    @Autowired
    private SmsDao smsDao;

    //模拟发送验证码
    @GetMapping("/setSmsToRedis/{phone}/{message}")
    public void setSmsToRedis(@PathVariable("phone")String phone,@PathVariable("message") String message){
        smsDao.setSmsToRedis(phone,message);
    }

    //取出验证码进行校验
    @GetMapping("/getSmsToRedis/{phone}")
    public String getSmsToRedis(@PathVariable("phone")String phone){
        return smsDao.getSmsToRedis(phone);
    }
}
